<template>
    <el-table :data="data" style="width: 100%" v-loading="loading">
        <el-table-column prop="host" label="站点" width="180" />
        <el-table-column prop="link" label="小说链接" width="180" />
        <el-table-column prop="name" label="书名" />
        <el-table-column prop="author" label="作者" />
        <el-table-column prop="isInstalment" label="连载" />
        <el-table-column prop="updateTime" label="更新时间" />
        <el-table-column prop="lastChapter" label="最新章节" />
        <el-table-column prop="status" label="入库状态" />
    </el-table>
</template>

<script>

import { queryData } from '@/api/novel/index'

export default {
    props: {
        query: Object
    },
    setup(props, { emit }) {
        const loading = ref(false)

        const data = ref([])
        //const currentPage = ref(1)
        //const pageSize = ref(10)
        //const total = ref(10)


        async function getInfo() {
            loading.value = true
            try {
                var response = await queryData(props.query)
                // result.value = response.data.result.data
                //pageSize.value = response.data.result.pageSize
                //currentPage.value = response.data.result.currentPage
                //total.value = response.data.result.total

                const { data:result, total } = response.result

                data.value = result
                //console.log(data)
                emit("onGetInfo", { total })
            }
            finally {
                loading.value = false
            }
        }

        watch(props, () => {
            getInfo()
        })

        getInfo()

        return { data, loading }
    }
}



</script>